<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/10/31
 * Time: 10:09
 */

namespace app\admin\controller;


use app\common\controller\Base;


class Qadmin extends Base
{
    protected $getList = 'QqCodeMapping';

    public function index()
    {
        return $this->fetch();
    }

    public function update($id)
    {
        $status = input('status');
        if (!$status){
            return $this->errorInfo('非法');
        }
        $g = ($this->model)::get($id);
        if (!$g){
            return $this->errorInfo('异常访问');
        }
        $r = $g->save(['status'=>$status]);
        if ($r===false){
            return $this->errorInfo('保存失败');
        }
        return $this->successInfo('成功');
    }

    public function detail($id)
    {
        $qq = ($this->model)::get($id);
        if (!$qq){
            return $this->errorInfo('非法访问');
        }
        $this->assign('qq',$qq);
        return $this->fetch();
    }
}